package com.c.controller;

import com.c.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author wangxiangli
 * @create 2022-12-23-16:50
 */
@RestController
@RequestMapping("/test")
public class hellocontroller {

    @Autowired
    private UserService userService;


    @DeleteMapping("hello")
    public String hello(){

        return "hello,springsecurity";
    }


    @GetMapping("wang")
    @PreAuthorize("hasAuthority('USER_ADD')")
    public String wang(){

        return "hello,wang";
    }

    @GetMapping("/index")
    public String index(){

        return "index";
    }

    @GetMapping("/ok")
    @PreAuthorize("hasAnyAuthority('hhhhhh')")
    public String ok(){

        return "okokok";
    }

}
